<?php
namespace App\Admin\Actions\Row;

use App\Admin\Forms\AuditForm;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;

class AuditActions extends RowAction
{
    protected $title = '审核';

    protected $table;

    public function __construct($table)
    {
        $this->table = $table;

        parent::__construct($this -> title);
    }

    public function render()
    {
        $form = AuditForm::make()->payload(['id' => $this->getKey(),'table' => $this->table]);

        $button = <<<HTML
            <a><i class="feather icon-rotate-ccw text-warning"></i> <span class="text-warning">{$this->title}</span> &emsp;</a>
        HTML;

        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body($form)
            ->button($button);
    }
}
